<template>
    <el-card>
         <el-form :model="queryParams" ref="queryParams" :inline="true" label-width="100px">
            <el-form-item label="来源IP" prop="app">
                <el-input v-model="queryParams.app" placeholder="来源IP" size="small"></el-input>
            </el-form-item>
            <el-form-item label="网关分组" prop="appName">
                <el-input v-model="queryParams.path" placeholder="网关分组" size="small"></el-input>
            </el-form-item>
             <el-form-item label="服务名" prop="appName">
                <el-input v-model="queryParams.path" placeholder="服务名" size="small"></el-input>
            </el-form-item>
             <el-form-item label="请求方法" prop="appName">
                <el-input v-model="queryParams.path" placeholder="请求方法" size="small"></el-input>
            </el-form-item>
            <el-form-item label="appId" prop="appName">
                <el-input v-model="queryParams.path" placeholder="appId" size="small"></el-input>
            </el-form-item>
            <el-form-item label="API Path" prop="appName">
                <el-input v-model="queryParams.path" placeholder="API Path" size="small"></el-input>
            </el-form-item>
            <el-form-item >
                <el-button type="primary" icon="el-icon-search" size="small" @click="handleQuery">搜索</el-button>
                <el-button icon="el-icon-delete" size="small" @click="resetQuery('queryParams')">清空</el-button>
            </el-form-item>
        </el-form>
        <el-table :data="tableData" border style="width: 100%" size="small">
            <el-table-column type="index" label="#" width="50"></el-table-column>
            <el-table-column label="来源IP" prop="app"></el-table-column>
            <el-table-column label="网关分组" prop="appName"></el-table-column>
            <el-table-column label="服务名" prop="appName"></el-table-column>
            <el-table-column label="请求方法" prop="appName"></el-table-column>
            <el-table-column label="appID" prop="appName"></el-table-column>
            <el-table-column label="API Path" prop="appName"></el-table-column>
            <el-table-column label="请求次数" prop="appName"></el-table-column>
            <el-table-column label="最近请求时间" prop="appName"></el-table-column>
        </el-table>
        <el-pagination
                v-show="total>0"
                @size-change="handleSizeChange"
                @current-change="handleCurrentChange"
                background
                :current-page="1"
                :page-sizes="[10, 20, 30, 40,50,100]"
                :page-size="10"
                layout="total, sizes, prev, pager, next, jumper"
                class="pagination-container"
                :total="total">
         </el-pagination>
    </el-card>
</template>

<script>
import { getProxyIpList } from '@/api/proxy/ip.api.js'
    export default {
        data() {
            return {
                tableData:[],
                queryParams: {},
                total: 0
            }
        },
        mounted() {
            this.getList();
        },
        methods: {
            async getList() {
                const params = {current:1,size: 10};
                const result = await getProxyIpList(params);
                if(result.code === 200) {
                    this.tableData = result.data.records;
                    this.total = result.data.total;
                }
            },
            // 搜索
            handleQuery() {
                this.queryParams.current = 1;
                this.getList();
            },
            // 清空
            resetQuery(formName) {
                this.$refs[formName].resetFields();
                this.getList();
            },
            handleSizeChange(val) {
                this.queryParams.size = val;
                this.getList();
            },
            handleCurrentChange(val) {
                this.queryParams.current = val;
                this.getList();
            }
        },
       
    }
</script>

<style lang="scss" scoped>

</style>